package com.dys.testlambda03;

import com.dys.testlambda03.service.OrderService;
import com.dys.testlambda03.service.StudentService;

/**
 * @className: com.dys.testlambda03.LambdaTest01
 * @description: com.dys.testlambda03
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/08/29 下午10:48
 */
public class LambdaTest01 {
    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) {
        goStudent((String name, int age) -> {
            return name + ",今年" + age + "岁了";
        });
        // 省略写法
        goStudent((name, age) -> name + ",今年" + age + "岁了");
        // ------------
        goOrder((String name) -> {
            System.out.println("---->" + name);
            return 1001;
        });
        // 省略写法
        goOrder(name -> {
            System.out.println("---->" + name);
            return 1002;
        });
        goOrder(name -> 1003);
    }

    public static void goStudent(StudentService s) {
        s.show("张思思", 25);
    }

    public static void goOrder(OrderService s) {
        s.showNum("李春生");
    }
}
